<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE>
<html>
<head>
<meta charset="UTF-8">
<title>My first Three.js app</title>
<style>canvas { width: 100%; height: 100% }</style>
</head>
<body>
	<script src="three.js"></script>
	<script>
		// 创建有个场景
		var scene = new THREE.Scene();
		// 创建一个相机
		var camera = new THREE.PerspectiveCamera(45, window.innerWidth/window.innerHeight, 1, 1000);

		var renderer = new THREE.WebGLRenderer();
		renderer.setSize(window.innerWidth, window.innerHeight);
		document.body.appendChild(renderer.domElement);

		var geometry = new THREE.CubeGeometry(100,50,50);
		var material = new THREE.MeshBasicMaterial({color: 0x00ff00});
		var cube = new THREE.Mesh(geometry, material);
		scene.add(cube);

		camera.position.x = 0;
		camera.position.y = 100;
		camera.position.z = 0;
		camera.up.x = 0;
		camera.up.y = 0;
		camera.up.z = 1;
		camera.lookAt( {x:0, y:0, z:0 } );

		var render = function () {
			requestAnimationFrame(render);

			/* cube.rotation.x += 0.1;
			cube.rotation.y += 0.1; */

			renderer.render(scene, camera);
		};

		render();
	</script>
</body>
</html>